*** Settings ***
Documentation    Suite description
Library  Collections
Library  RequestsLibrary
Library  ../SuperChauffeuringApp/SuperChauffeuringApp.py
Resource  ../SuperChauffeuringApp/Variables/Params.txt

*** Variables ***
${domian}   https://a.heyuapp.cn/spappdev
#*** Keywords ***

*** Test Cases ***
0001
    [Tags]  【计费模板/模板详情】
    [Documentation]  计费模板详情
    CREATE SESSION  ServiceDetail  ${domian}    verify=True
    ${headers}  CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
    ${data}     CREATE DICTIONARY  tempId=12313
    ${resps}    POST REQUEST  ServiceDetail     /spappdev/webapi/app/feetemp/service/detail     json=${data}    headers=${headers}
    LOG TO CONSOLE      ${resps.content.decode()}


0002
    [Tags]  【计费模板/模板详情信息展现】
    [Documentation]     计费模板展示信息
    CREATE SESSION  ServiceInfo     ${domian}   verify=True
    ${headers}      CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
    ${data}     CREATE DICTIONARY  feeTempId=1234
    ${resps}    POST REQUEST    ServiceInfo     /webapi/app/feetemp/service/info   json=${data}    headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    LOG TO CONSOLE  ${resps.content.decode()}
    ${resp}     TO JSON  ${resps.content}
    ${status}   GET FROM DICTIONARY  ${resp}    status
    ${msg}      GET FROM DICTIONARY  ${resp}    msg
    ${result}   GET FROM DICTIONARY  ${resp}    result
    ${tempId}   GET FROM DICTIONARY  ${result}  tempId
    ${tempTitle}    GET FROM DICTIONARY  ${result}      tempTitle
    ${isStandard}   GET FROM DICTIONARY  ${result}      isStandard
    ${items}        GET FROM DICTIONARY  ${result}      items
    SHOULD BE EQUAL AS STRINGS  ${status}   1
    SHOULD BE EQUAL AS STRINGS  ${msg}      success
    SHOULD BE EQUAL AS STRINGS  ${tempId}   AAssweq242
    SHOULD BE EQUAL AS STRINGS  ${tempTitle}    杭州市滴滴模板
    SHOULD BE EQUAL AS STRINGS  ${isStandard}   1
    SHOULD NOT BE EMPTY  ${items}

0003
    [Tags]  【计费模板/模板列表】
    [Documentation]  	计费模板列表
    CREATE SESSION  ServiceList     ${domian}   verify=True
    ${headers}      CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
#    ${data}     CREATE DICTIONARY
    ${resps}    POST REQUEST  ServiceList   /webapi/app/feetemp/service/list   headers=${headers}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON  ${resps.content}
    ${status}   GET FROM DICTIONARY  ${resp}    status
    ${msg}      GET FROM DICTIONARY  ${resp}    msg
    ${result}    GET FROM DICTIONARY  ${resp}    result
    ${feeTempList}  GET FROM DICTIONARY  ${result}   feeTempList
    SHOULD BE EQUAL AS STRINGS  ${status}   1
    SHOULD BE EQUAL AS STRINGS  ${msg}      success


0004
    [Tags]  【首页/系统首页】
    [Documentation]  提供了底部按钮
    CREATE SESSION  MainHome    ${domian}   verify=True
    ${headers}  CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
    ${resps}    POST REQUEST  MainHome     /webapi/app/main/home
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON  ${resps.content}
    LOG TO CONSOLE  ${resp}
    ${status}   GET FROM DICTIONARY  ${resp}    status
    ${msg}  GET FROM DICTIONARY  ${resp}    msg
    ${result}   GET FROM DICTIONARY  ${resp}    result
    ${navs}     GET FROM DICTIONARY  ${result}  navs
    ${type_creatRoute}  GET FROM DICTIONARY  ${navs}[0]     type
    ${icon_creatRoute}  GET FROM DICTIONARY  ${navs}[0]     icon
    ${params_creatRoute}    GET FROM DICTIONARY  ${navs}[0]     params
    ${status_creatRoute}    GET FROM DICTIONARY  ${navs}[0]     status
    ${width_creatRoute}     GET FROM DICTIONARY  ${navs}[0]     width
    ${type_deliver}     GET FROM DICTIONARY  ${navs}[1]     type
    ${icon_deliver}     GET FROM DICTIONARY  ${navs}[1]     icon
    ${params_deliver}           GET FROM DICTIONARY  ${navs}[1]     params
    ${status_deliver}   GET FROM DICTIONARY  ${navs}[1]     status
    ${width_deliver}    GET FROM DICTIONARY  ${navs}[1]     width
    ${type_badge}       GET FROM DICTIONARY  ${navs}[2]     type
    ${icon_badge}       GET FROM DICTIONARY  ${navs}[2]     icon
    ${params_badge}     GET FROM DICTIONARY  ${navs}[2]     params
    ${status_badge}     GET FROM DICTIONARY  ${navs}[2]     status
    ${width_badge}      GET FROM DICTIONARY  ${navs}[2]     width
#    ${navs2}    GET FROM DICTIONARY  ${result}      navs
    SHOULD BE EQUAL AS STRINGS  ${status}   1
    SHOULD BE EQUAL AS STRINGS  ${msg}      success
    SHOULD BE EQUAL AS STRINGS  ${type_creatRoute}      createRoute
    SHOULD BE EQUAL AS STRINGS  ${icon_creatRoute}      http://image-ant.sixapp.cn/heyu-superdriver/2021-01-12-0002.png
    SHOULD BE EQUAL AS STRINGS  ${params_creatRoute}    {'url': '/routePages/localtionMap/index'}
    SHOULD BE EQUAL AS STRINGS  ${status_creatRoute}    1
    SHOULD BE EQUAL AS STRINGS  ${width_creatRoute}     100%
    SHOULD BE EQUAL AS STRINGS  ${type_deliver}     deliver
    SHOULD BE EQUAL AS STRINGS  ${icon_deliver}     http://image-ant.sixapp.cn/heyu-superdriver/home-deliver-image2.jpg
    SHOULD BE EQUAL AS STRINGS  ${params_deliver}   {'url': '/subPages/deliverOrder/index'}
    SHOULD BE EQUAL AS STRINGS  ${status_deliver}   1
    SHOULD BE EQUAL AS STRINGS  ${width_deliver}    50%
    SHOULD BE EQUAL AS STRINGS  ${type_badge}       badge
    SHOULD BE EQUAL AS STRINGS  ${icon_badge}       http://image-ant.sixapp.cn/heyu-superdriver/home-badge-image.png
    SHOULD BE EQUAL AS STRINGS  ${params_badge}     {'url': '/subPages/badge/index'}
    SHOULD BE EQUAL AS STRINGS  ${status_badge}     1
    SHOULD BE EQUAL AS STRINGS  ${width_badge}      50%
    LENGTH SHOULD BE  ${navs}   3
    DICTIONARY SHOULD CONTAIN KEY  ${result}    navs2


0005
    [Tags]  【首页/用户切换】
    [Documentation]     切换功能
    CREATE SESSION  MainMagic   ${domian}   verify=True
    ${headers}      CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
    LOG TO CONSOLE  ${headers}
    ${resps}    GET REQUEST     MainMagic   /webapi/app/main/magic      headers=${headers}
    LOG TO CONSOLE  ${resps.content}
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON  ${resps.content}
    ${status}   GET FROM DICTIONARY  ${resp}    status
    ${msg}  GET FROM DICTIONARY  ${resp}    msg
    ${result}   GET FROM DICTIONARY  ${resp}    result
    SHOULD BE EQUAL AS STRINGS  ${status}   1
    SHOULD BE EQUAL AS STRINGS  ${msg}      success
    DICTIONARY SHOULD CONTAIN KEY  ${resp}  result


0006
    [Tags]  【首页/基础参数】
    [Documentation]  当前用户相关参数，供前端进行全局性的界面设置
    CREATE SESSION  MainProfile     ${domian}   verify=True
    ${headers}  CREATE DICTIONARY  Content-Type=application/json   Charset=utf-8   Cookie=${Cookie}
    ${resps}    GET REQUEST  MainProfile    /webapi/app/main/profile
    SHOULD BE EQUAL AS STRINGS  ${resps.status_code}    200
    ${resp}     TO JSON  ${resps.content}
    ${status}   GET FROM DICTIONARY  ${resp}    status
    ${msg}  GET FROM DICTIONARY  ${resp}    msg
    ${locationBtn}     GET FROM DICTIONARY  ${resp}[result][buttons]     locationBtn
    ${createOrderBtn}   GET FROM DICTIONARY  ${resp}[result][buttons]   createOrderBtn
    ${plazaMinBalance}  GET FROM DICTIONARY  ${resp}[result]    plazaMinBalance
    ${locationReminder}     GET FROM DICTIONARY  ${resp}[result]    locationReminder
    ${introUrl}     GET FROM DICTIONARY  ${resp}[result]    introUrl
    ${createUrl}    GET FROM DICTIONARY  ${resp}[result]    createUrl
    ${webank}       GET FROM DICTIONARY  ${resp}[result][webank]    details
    ${pagetitle}    GET FROM DICTIONARY  ${resp}[result][insurance]     pageTitle
    ${noAuditHintTitle}     GET FROM DICTIONARY  ${resp}[result][insurance][noAuditHint]    title
    ${noAuditHintContent}   GET FROM DICTIONARY  ${resp}[result][insurance][noAuditHint]    content
    ${auditHint}    GET FROM DICTIONARY  ${resp}[result][insurance]     auditHint
    ${insuranceDetails}     GET FROM DICTIONARY  ${resp}[result][insurance]     details
    ${reportImage}  GET FROM DICTIONARY  ${resp}[result][insurance][report]     image
    ${reportButtons}    GET FROM DICTIONARY  ${resp}[result][insurance][report]     buttons
    ${reportButton1}    GET FROM DICTIONARY  ${reportButtons}[0]    title
    ${reportButton1Value}    GET FROM DICTIONARY  ${reportButtons}[0]    value
    ${reportButton2}    GET FROM DICTIONARY  ${reportButtons}[1]    title
    ${reportButton2Value}    GET FROM DICTIONARY  ${reportButtons}[1]    value
    ${anchor}   GET FROM DICTIONARY  ${resp}[result][insurance][report]     anchor
    SHOULD BE EQUAL AS STRINGS  ${status}   1
    SHOULD BE EQUAL AS STRINGS  ${msg}  success
    SHOULD BE EQUAL AS STRINGS  ${locationBtn}   下一步
    SHOULD BE EQUAL AS STRINGS  ${createOrderBtn}   确认车况，开始行程
    SHOULD BE EQUAL AS STRINGS  ${plazaMinBalance}  50
    SHOULD BE EQUAL AS STRINGS  ${locationReminder}     设置一下，可以自由看微信，打电话，不影响跳表
    SHOULD BE EQUAL AS STRINGS  ${introUrl}     http://image-ant.sixapp.cn/heyu-superdriver/introduction-bg2.png
    SHOULD BE EQUAL AS STRINGS  ${createUrl}    http://image-ant.sixapp.cn/heyu-superdriver/intro-create-img.png
    LENGTH SHOULD BE  ${webank}     6
    SHOULD BE EQUAL AS STRINGS  ${pageTitle}    会员权益
    SHOULD BE EQUAL AS STRINGS  ${noAuditHintTitle}     享受会员权益，需认证身份
    SHOULD BE EQUAL AS STRINGS  ${noAuditHintContent}   请提前进行认证，以免代驾服务被临时中断
    SHOULD BE EQUAL AS STRINGS  ${auditHint}    您已通过认证，每次行程前可选择全程保障
    LENGTH SHOULD BE  ${insuranceDetails}   5
    SHOULD BE EQUAL AS STRINGS  ${reportImage}      http://image-ant.sixapp.cn/heyu-superdriver/insure/chuxian-process2.png
    SHOULD BE EQUAL AS STRINGS  ${reportButton1}    拨打 95519，代驾险报案
    SHOULD BE EQUAL AS STRINGS  ${reportButton1Value}   95519
    SHOULD BE EQUAL AS STRINGS  ${reportButton2}    联系超级代驾客服
    SHOULD BE EQUAL AS STRINGS  ${reportButton2Value}   057126206536
    SHOULD BE EQUAL AS STRINGS  ${anchor}       中国人寿代驾责任险说明
